package com.yonyou.cyxdms.sysAuth.service.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yonyou.cyx.function.utils.common.DateUtil;
import com.yonyou.cyxdms.framework.bean.entity.base.DMSBasePO;
import com.yonyou.cyxdms.sysAuth.service.dto.user.EmpDTO;
import com.yonyou.cyxdms.sysAuth.service.dto.user.EmployeeDTO;
import org.springframework.util.StringUtils;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Date;

/**
 * 是否往来客户账户表
* @author 崔韬
* @date 2019-01-11
*/
@TableName("tm_emp")
public class EmpPo extends DMSBasePO<EmpPo> {

    private static final long serialVersionUID = 1L;
    @TableId(value = "EMP_ID", type = IdType.AUTO)
    private Long empId;

    @TableField("APP_ID")
    private String appId;
    /**
     * DEALER_CODE
     */
    @TableField("COMPANY_ID")
    private Integer companyId;
    /**
     * EMPLOYEE_NAME
     */
    @TableField("EMPLOYEE_NAME")
    private String employeeName;
    /**
     * GENDER
     */
    @TableField("GENDER")
    private Integer gender;
    /**
     * E_MAIL
     */
    @TableField("E_MAIL")
    private String eMail;
    /**
     * ZIP_CODE
     */
    @TableField("ZIP_CODE")
    private String zipCode;
    /**
     * MOBILE
     */
    @TableField("MOBILE_PHONE")
    private String mobilePhone;

    /**
     * ADDRESS
     */
    @TableField("ADDRESS")
    private String address;

    /**
     * FOUND_DATE
     */
    @TableField("FOUND_DATE")
    private Date foundDate;
    /**
     * BIRTHDAY
     */
    @TableField("BIRTHDAY")
    private Date birthday;
    /**
     * DIMISSION_DATE
     */
    @TableField("DIMISSION_DATE")
    private Date dimissionDate;
    /**
     * IS_ONJOB
     */
    @TableField("IS_ONJOB")
    private Integer isOnjob;
    /**
     * USER_CODE
     */
    @TableField(value = "USER_CODE")
    private String userCode;

    /**
     * USER_STATUS
     */
    @TableField("USER_STATUS")
    private Integer userStatus;
    /**
     * DATA_SOURCES
     */
    @TableField("DATA_SOURCES")
    private Integer dataSources;
    /**
     * SOURCE_CHANGED_AT
     */
    @TableField("SOURCE_CHANGED_AT")
    private Date sourceChangedAt;
    /**
     * MARRIAGE_STATUS
     */
    @TableField("MARRIAGE_STATUS")
    private Date marriageStatus;

    /**
     * PHOTOS
     */
    @TableField(value = "PHOTOS")
    private Integer photos;
    /**
     * REMARK
     */
    @TableField(value = "REMARK")
    private String remark;

    /**
     * QQ
     */
    @TableField(value = "QQ")
    private String qq;
    /**
     * UNIVERSITY
     */
    @TableField(value = "UNIVERSITY")
    private String university;

    /**
     * NATIVE_PLACE
     */
    @TableField(value = "NATIVE_PLACE")
    private String nativePlace;
    /**
     * REGISTERED
     */
    @TableField(value = "REGISTERED")
    private String registered;

    /**
     * AUTHENTICATION
     */
    @TableField(value = "AUTHENTICATION")
    private String authentication;

    /**
     * `VALID_STATUS`
     */
    @TableField(value = "VALID_STATUS")
    private Integer validStatus;

    @TableField("IS_REPLACE")
    private Integer isReplace;


    /**
     * RECORD_VERSION
     */
    @TableField("RECORD_VERSION")
    private Integer recordVersion;
    /**
     * CERTIFICATE_ID
     */
    @TableField(value = "CERTIFICATE_ID")
    private String certificateId;

    /**
     * 民族
     */
    @TableField(value = "NATION")
    private String nation;
    /**
     * 驾驶证级别
     */
    @TableField(value = "DRIVING_LEVEL")
    private String drivingLevel;
    /**
     * 教育程度
     */
    @TableField(value = "DEGREE_EDU")
    private Integer degreeEdu;
    /**
     * 年龄
     */
    @TableField(value = "AGE")
    private Integer age;
    /**
     * 汽车行业时长（年）
     */
    @TableField(value = "AUTO_TIME")
    private Integer autoTime;
    /**
     * 是否校企合作院校毕业
     */
    @TableField(value = "COOPERATION_SCHOOL")
    private Integer cooperationSchool;
    /**
     * 毕业院校
     */
    @TableField(value = "GRADUATE_SCHOOL")
    private String graduateSchool;
    /**
     * 自定义职位
     */
    @TableField(value = "ROLE_NAME")
    private String roleName;

    public String getRoleName() { return roleName; }

    public void setRoleName(String roleName) { this.roleName = roleName; }
    public String getNation() {
        return nation;
    }

    public void setNation(String nation) {
        this.nation = nation;
    }

    public String getDrivingLevel() {
        return drivingLevel;
    }

    public void setDrivingLevel(String drivingLevel) {
        this.drivingLevel = drivingLevel;
    }

    public Integer getDegreeEdu() {
        return degreeEdu;
    }

    public void setDegreeEdu(Integer degreeEdu) {
        this.degreeEdu = degreeEdu;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public Integer getAutoTime() {
        return autoTime;
    }

    public void setAutoTime(Integer autoTime) {
        this.autoTime = autoTime;
    }

    public Integer getCooperationSchool() {
        return cooperationSchool;
    }

    public void setCooperationSchool(Integer cooperationSchool) {
        this.cooperationSchool = cooperationSchool;
    }

    public String getGraduateSchool() {
        return graduateSchool;
    }

    public void setGraduateSchool(String graduateSchool) {
        this.graduateSchool = graduateSchool;
    }

    public EmpPo(EmpDTO dto) {
//        this.empId = dto.getEmpId();
//        this.dealerCode = dealerCode;
        this.appId = dto.getAppId();
        this.employeeName = dto.getEmployeeName();
//        this.userCode = userCode;
//        this.userStatus = userStatus;
//        this.password = password;
//        this.loginLastTime = loginLastTime;
//        this.failureNum = failureNum;
//        this.lockFlag = lockFlag;
//        this.recordVersion = recordVersion;
//        this.employeeNo = dto.getEmployeeNo();
        this.gender = dto.getGender();
        this.eMail = dto.geteMail();
        this.zipCode = dto.getZipCode();
//        this.phone = dto.getMobilePhone();
        this.certificateId = dto.getIdentifyId();
//        this.phone = dto.getMobilePhone();
//        this.isReplace = isReplace;
        this.address = dto.getAddress();
//        this.foundDate = foundDate;
//        if(!StringUtils.isEmpty(dto.getBirthday())){
//            this.birthday = DateUtil.parseDate(dto.getBirthday(),"yyyy-MM-dd HH:mm:ss");
//        }
//        this.isOnjob = dto.getIsOnjob();
//        this.dimissionDate = dimissionDate;
//        this.dataSources = dataSources;
//        this.sourceId = dto.getSourceId();
        if (!StringUtils.isEmpty(dto.getSourceChangedAt())) {
            this.sourceChangedAt = DateUtil.parseDate(dto.getSourceChangedAt(), "yyyy-MM-dd HH:mm:ss");
        }
//        this.isShow = dto.getValidStatus(); //TODO
//        this.isPartCustomer = isPartCustomer;
//        this.openId = openId;
        this.headPortrait = String.valueOf(dto.getPhotos());
        this.wechat = dto.getWechat();
    }

    public EmpPo(EmployeeDTO dto) {
        this.empId = dto.getEmpId();
//        this.dealerCode = dealerCode;
        this.appId = dto.getAppId();
        this.employeeName = dto.getEmployeeName();
//        this.userCode = userCode;
//        this.userStatus = userStatus;
//        this.password = password;
//        this.loginLastTime = loginLastTime;
//        this.failureNum = failureNum;
//        this.lockFlag = lockFlag;
//        this.recordVersion = recordVersion;
//        this.employeeNo = dto.getEmployeeNo();
        this.gender = dto.getGender();
        this.eMail = dto.geteMail();
        this.zipCode = dto.getZipCode();
        //       this.phone = dto.getMobilePhone();
        this.certificateId = dto.getIdentifyId();
//        this.isReplace = isReplace;
        this.address = dto.getAddress();
//        this.foundDate = foundDate;
//        if(!StringUtils.isEmpty()){
//            LocalDateTime localDateTime = dto.getSourceChangedAt();
//            ZoneId zoneId = ZoneId.systemDefault();
//            ZonedDateTime zdt = localDateTime.atZone(zoneId);
//            Date date = Date.from(zdt.toInstant());
//            this.birthday = DateUtil.parseDate(dto.getBirthday(),"yyyy-MM-dd HH:mm:ss");
//        }
//        this.isOnjob = dto.getIsOnjob();
//        this.dimissionDate = dimissionDate;
//        this.dataSources = dataSources;
//        this.sourceId = dto.getSourceId();
        if (!StringUtils.isEmpty(dto.getSourceChangedAt())) {
            LocalDateTime localDateTime = dto.getSourceChangedAt();
            ZoneId zoneId = ZoneId.systemDefault();
            ZonedDateTime zdt = localDateTime.atZone(zoneId);
            Date date = Date.from(zdt.toInstant());
            this.sourceChangedAt = date;
        }
        //      this.isShow = dto.getValidStatus(); //TODO
//        this.isPartCustomer = isPartCustomer;
//        this.openId = openId;
//        this.headPortrait = dto.getPhotos();
        this.wechat = dto.getWechat();
    }

//    public EmpPo(EmployeePO dto) {
//        this.appId = dto.getAppId();
//        // this.employeeName = dto.getEmployeeName();
//        this.userCode = dto.getEmployeeNo();
//    }

    public String getMobilePhone() {
        return mobilePhone;
    }

    public void setMobilePhone(String mobilePhone) {
        this.mobilePhone = mobilePhone;
    }

    public Date getMarriageStatus() {
        return marriageStatus;
    }

    public void setMarriageStatus(Date marriageStatus) {
        this.marriageStatus = marriageStatus;
    }

    public Integer getPhotos() {
        return photos;
    }

    public void setPhotos(Integer photos) {
        this.photos = photos;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getQq() {
        return qq;
    }

    public void setQq(String qq) {
        this.qq = qq;
    }

    public String getUniversity() {
        return university;
    }

    public void setUniversity(String university) {
        this.university = university;
    }

    public String getNativePlace() {
        return nativePlace;
    }

    public void setNativePlace(String nativePlace) {
        this.nativePlace = nativePlace;
    }

    public String getRegistered() {
        return registered;
    }

    public void setRegistered(String registered) {
        this.registered = registered;
    }

    public String getAuthentication() {
        return authentication;
    }


    /**
     * 微信OPEN_ID
     */
    @TableField("OPEN_ID")
    private String openId;
    /**
     * 头像地址
     */
    @TableField("HEAD_PORTRAIT")
    private String headPortrait;

    @TableField("WECHAT")
    private String wechat;



    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public String getWechat() {
        return wechat;
    }

    public void setWechat(String wechat) {
        this.wechat = wechat;
    }

    public String getOpenId() {
        return openId;
    }

    public void setOpenId(String openId) {
        this.openId = openId;
    }

    public String getHeadPortrait() {
        return headPortrait;
    }

    public void setHeadPortrait(String headPortrait) {
        this.headPortrait = headPortrait;
    }

    public Integer getIsReplace() {
        return isReplace;
    }

    public void setIsReplace(Integer isReplace) {
        this.isReplace = isReplace;
    }

    public Long getEmpId() {
        return empId;
    }

    public void setEmpId(Long empId) {
        this.empId = empId;
    }

    public static long getserialversionuid() {
        return serialVersionUID;
    }

    public String getEmployeeName() {
        return employeeName;
    }

    public void setEmployeeName(String employeeName) {
        this.employeeName = employeeName;
    }

    public String getUserCode() {
        return userCode;
    }

    public void setUserCode(String userCode) {
        this.userCode = userCode;
    }

    public Integer getUserStatus() {
        return userStatus;
    }

    public void setUserStatus(Integer userStatus) {
        this.userStatus = userStatus;
    }


    @Override
    public Integer getRecordVersion() {
        return recordVersion;
    }

    @Override
    public void setRecordVersion(Integer recordVersion) {
        this.recordVersion = recordVersion;
    }

    public Integer getGender() {
        return gender;
    }

    public void setGender(Integer gender) {
        this.gender = gender;
    }

    public String geteMail() {
        return eMail;
    }

    public void seteMail(String eMail) {
        this.eMail = eMail;
    }

    public String getZipCode() {
        return zipCode;
    }

    public void setZipCode(String zipCode) {
        this.zipCode = zipCode;
    }

    public String getCertificateId() {
        return certificateId;
    }

    public void setCertificateId(String certificateId) {
        this.certificateId = certificateId;
    }

    public Integer getCompanyId() {
        return companyId;
    }

    public void setCompanyId(Integer companyId) {
        this.companyId = companyId;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public Date getFoundDate() {
        return foundDate;
    }

    public void setFoundDate(Date foundDate) {
        this.foundDate = foundDate;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    public Integer getIsOnjob() {
        return isOnjob;
    }

    public void setIsOnjob(Integer isOnjob) {
        this.isOnjob = isOnjob;
    }

    public Date getDimissionDate() {
        return dimissionDate;
    }

    public void setDimissionDate(Date dimissionDate) {
        this.dimissionDate = dimissionDate;
    }

    public Integer getDataSources() {
        return dataSources;
    }

    public void setDataSources(Integer dataSources) {
        this.dataSources = dataSources;
    }


    public Date getSourceChangedAt() {
        return sourceChangedAt;
    }

    public void setSourceChangedAt(Date sourceChangedAt) {
        this.sourceChangedAt = sourceChangedAt;
    }

    public void setValidStatus(Integer validStatus) {
        this.validStatus = validStatus;
    }

    public EmpPo() {
    }

    public void setAuthentication(String authentication) {
        this.authentication = authentication;
    }

    public Integer getValidStatus() {
        return validStatus;
    }

    public EmpPo(EmployeePO dto){
        this.appId=dto.getAppId();
//        this.employeeName = dto.getEmployeeName();
        this.userCode=dto.getEmployeeNo();
    }
}
